%{
#include <stdio.h>
extern int yylex();
extern void yyerror();
%}
%error-verbose
%token '\n' '+' '/' '*' '(' ')'
%token <intVal> NB
%token <floatVal> FLOAT
%type <floatVal> Expression List
%union {
  int intVal;
  float floatVal;
}
%left '+' '-'
%left '*' '/'

%%
List: 
    | List Expression '\n'  { $$=$2; printf("Valeur:%f || ",$2); }
    | error { printf("Erreur de syntaxe"); }
    ;

Expression: Expression '*' Expression  { $$=$1*$3; printf("*= %f | ",$$);  }
          | Expression '+' Expression  { $$=$1+$3; printf("+= %f | ",$$);  }
          | Expression '-' Expression  { $$=$1-$3; printf("-= %f | ",$$);  }
          | Expression '/' Expression  { $$=$1/$3; printf("/= %f | ",$$);  }
          | '(' Expression ')' { $$=$2; }
          | FLOAT { $$=$1; /* printf("Test NB = %f",$1); */ }
          ;

%%
